Tiny Hexer Script

In this topic you will find an introduction to the Tiny Hexer Script language.


top bottom

top bottom

Overview

Tiny Hexer Script is an interpreted programming language to add scripting capabilities to Tiny Hexer. Scripts are stored in text files using the file extension .mps. Each script consists of a sequence of commands separated by line feeds and/or colons (":"). Commands and functions are case insensitive. Comments ca be stored in a script file using the equal sign ("="). The language has conditional (IF...[ELSE...]ENDIF, REPEAT...UNTIL, WHILE...ENDWHILE) and unconditional flow control commands (CALL, GOTO and LOOP). Data can be stored in variables of various data types (TEXT, CHAR, BYTE, SIGBYTE, WORD, SIGWORD, LONGWORD, SIGLONGWORD, SIGQWORD, SINGLE, DOUBLE, EXTENDED, COMP, FILE and VARREF). Using the CALL() function and the LOCAL/ENDLOCAL commands you can implement custom subroutine functions.

A simple Tiny Hexer Script might look like the following (without line numbers):

1)    = Sample Script
2)    VAR txt TEXT
3)    @@LOOP_1
4)    LET txt = INPUT("Input Query", "Please enter some text (no text to exit)", txt)
5)    IF txt == "":END:ENDIF
6)    MSGBOX ("You entered:\r\n"+txt), 0x40
7)    GOTO LOOP_1

Description

Line 1): The equal sign ("=") tells Tiny Hexer to ignore the rest of this line (used to store comments in the script file).

Line 2): The variable txt of data type TEXT is defined (all variables must be defined in Tiny Hexer Script before they can be used).

Line 3): The label LOOP_1 is defined. Labels are used to name subroutines (CALL and LOOP commands) and targets for the GOTO command.

Line 4): The result of the function INPUT(...) is assigned to the variable txt.

Line 5): This line consists of three commands, separated by colons. The first command (IF) checks if the condition (txt == "") is met. If yes, the following command is executed. If not, the script continues at the command after the ENDIF command. The second command (END) tells Tiny Hexer to stop execution of the script. The third command (ENDIF) terminates the IF block.

Line 6): The MSGBOX command is executed to show a message to the user (the text he entered in this case).

Line 7): The GOTO command tells Tiny Hexer to continue script execution at label LOOP_1.



top bottom

Localizing Scripts

You can write localized versions of Tiny Hexer scripts. If you have an english version of a script called "myscript.mps" and also want to make available a german version of the script depending on the current language of Tiny Hexer, you simply have to name the german script version "myscript.mps.deu", Tiny Hexer will automatically choose "myscript.mps.deu" if if the german version is being executed (see LANGUAGE_EXT for available languages). This also applies to the INCLUDE preprocessor directive.


top bottom
mirkes.de's Tiny Hexer, Copyright ⌐ Markus Stephany. All rights reserved.